package nimble.unionpay.openapi;

import org.apache.commons.lang3.StringUtils;

public enum CardLevel {
    UNKNOWN("0","未知"),
    NORMAL_CARD  ("1","普卡"),
    SILVER_CARD ("2","银卡"),
    GLODEN_CARD("3","金卡"),
    PLATINUM_CARD("4","白金卡"),
    DIAMOND_CARD("5","钻石卡"),
    INFINITE_CARD("6","无限卡");

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    CardLevel(String code, String desc)
    {
        this.code=code;
        this.desc=desc;
    }

    public static CardLevel parse(String code)
    {
        for(CardLevel cardLevel:CardLevel.values())
        {
            if(StringUtils.equalsAny(code,cardLevel.name(),cardLevel.getCode()))
            {
                return cardLevel;
            }
        }
        return null;
    }
}
